<template>
	<view>
		<view class="navbar">
			<zbar></zbar>
			<view class="navbarcontent">
				<view class="nav_left" @click="openpop">
					<image class="img1" src="@/static/dw.png" mode=""></image>
					<view class="lefttext">
						{{address?address:'定位中...'}}
					</view>
					<image class="img2" src="/static/sj.png" mode=""></image>
				</view>
				<view v-if="isdwopen" class="nav_content" @click="$pageGo('/mainpage/search')">
					<image src="@/static/ss.png" mode=""></image>
					<view class="">搜索</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	//公共头部 作为首页和附近页面使用
	export default {
		name:"searchTop",
		props:{
			address:{
				type:String,
				default:'定位中'
			},
			isdwopen:{
				type:Boolean,
				default:false
			},
		},
		data() {
			return {
			};
		},
		onShow() {
			console.log('3333333333333333=========');
		},
		created() {
			console.log('2222223=========');
		},
		methods:{
			openpop(){
				this.$emit('openpop')
			}
		}
	}
</script>

<style lang="scss">
	.navbar {
		width: 100%;
		position: sticky;
		top: 0rpx;
		padding: 0rpx 10px;
		box-sizing: border-box;
		background-color: #fff;
		.navbarcontent {
			position: relative;
			height: 44px;
			display: flex;
			align-items: center;
			font-family: PingFang SC, PingFang SC;
			font-weight: 500;
			font-size: 28rpx;
			color: #000000;

			.nav_left {
				display: flex;
				height: 44px;
				align-items: center;

				.img1 {
					width: 52rpx;
					height: 52rpx;
				}

				.lefttext {
					width: 164rpx;
					white-space: nowrap;
					overflow: hidden;
					text-overflow: ellipsis;
					margin: 0rpx 16rpx;
				}

				.img2 {
					width: 24rpx;
					height: 18rpx;
				}
			}

			.nav_content {
				width: 200rpx;
				height: 68rpx;
				background: #F9F9F9;
				border-radius: 34rpx;
				margin-left: 20rpx;
				display: flex;
				align-items: center;
				padding: 0rpx 22rpx;
				box-sizing: border-box;

				image {
					width: 48rpx;
					height: 48rpx;
					margin-right: 16rpx;
				}
			}

		}
	}
</style>